home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Die Speccy' 97
/
Die Speccy' 97.iso
/
amiga_system
/
the_aminet
/
comm
/
bbs
/
bbbbs85.lha
/
rexx
/
bbsXferStats.baud
< prev
next >
Wrap
Text File
|
1995-01-25
|
4KB
|
174 lines
/* $VER: bbsXferStats.rexx 8.4 (25.1.95) */
OPTIONS RESULTS
NUMERIC DIGITS 14
SIGNAL ON FAILURE
SIGNAL ON SYNTAX
PARSE ARG indx filename colorflag protocol extdir .
CR='0D'x
def=''
pen3='
'
IF colorflag=0 THEN
DO
def=''
pen3=''
END
lineup='1B'x'M'
bbspath=GETCLIP('BBS_path')
tfail=''
bytes=''
Status z
string=RESULT
string=COMPRESS(string,'0D'x)
Status Vers
BB_VERS=RESULT
IF RIGHT(BB_VERS,4)>1.59 THEN
DO
PARSE VAR string . 'Local Name: 'temp . 'Xfer''ed: 'bytes . 'Elapsed Time: 'min':'sec'0A'x .
slash=LASTPOS('/',temp)
IF slash=0 THEN slash=LASTPOS(':',temp)
IF slash~=0 THEN temp=SUBSTR(temp,slash+1)
END
ELSE PARSE VAR string temp' 'min':'sec . 'Bytes:'bytes .
temp=STRIP(temp)
min=STRIP(min)
sec=STRIP(sec)
bytes=STRIP(bytes)
IF temp~='' & LEFT(UPPER(STRIP(temp)),8)~=LEFT(UPPER(filename),8) THEN
tfail='wrong file' temp
ELSE IF DATATYPE(min,'W') & DATATYPE(sec,'W') & DATATYPE(bytes,'W') THEN
DO
secs=(min*60)+sec
IF indx=14 THEN CALL DELAY(99) /* wait for dos to finish upload */
temp=STATEF(PRAGMA('D')'/'filename)
temp=WORD(temp,2)
IF ~DATATYPE(temp,'W') THEN temp=0
IF indx=14 & (temp+1024)<bytes THEN tfail='ul size'
IF indx=15 & temp>(bytes+1024) THEN tfail='dl size'
END
ELSE tfail='transfer stats were not numeric! min='min 'sec='sec 'bytes='bytes
IF tfail~='' THEN
DO
line=PRAGMA('D')'/'filename pen3'*** Transfer failed! ***'def
SAY line||CR
CALL send2log(line 'tfail:'tfail)
CALL send2log('***' string)
ADDRESS AREXX bbsSounds.rexx bbspath'Sounds/' 'TFAIL'
IF indx=14 & WORD(STATEF(filename),2)=0 THEN CALL DELETE(filename)
EXIT 1
END
ELSE IF secs>0 THEN
Say 'Transfer Speed:' TRUNC(bytes/secs+.05,1) 'characters per second.'CR
Remote OFF
Send '^G'
Remote ON
line=left(filename,16,' ')
IF indx=14 THEN
DO
temp=countcheck(bbspath'Numbers/Bytes.UpLoad' 0)+bytes
CALL countcheck(bbspath'Numbers/Bytes.UpLoad' temp)
line=line 'uled'
END
ELSE
DO
temp=countcheck(bbspath'Numbers/Bytes.DownLoad' 0)+bytes
CALL countcheck(bbspath'Numbers/Bytes.DownLoad' temp)
temp=countcheck(bbspath'Numbers/Files.DownLoad' 0)+1
CALL countcheck(bbspath'Numbers/Files.DownLoad' temp)
tfiles=''
xdev=''
IF EXISTS(filename'.xdl') THEN
DO
IF OPEN(f,filename'.xdl','R')~=0 THEN
DO
xdev=READLN(f)
tfiles=READLN(f)
CALL CLOSE(f)
END
END
ELSE IF extdir~='' THEN
DO
num=POS(':',extdir)
IF num>1 THEN temp=LEFT(extdir,num-1)
IF SHOWLIST('A',UPPER(temp)) THEN xdev=temp
END
IF xdev='' THEN
DO
temp=PRAGMA('D')
xdev=SPACE(LEFT(temp,POS(':',temp)-1),1,'_')
END
IF ~DATATYPE(tfiles,'W') THEN tfiles=1
temp=countcheck(bbspath'Numbers/Bytes.X.'xdev 0)+bytes
CALL countcheck(bbspath'Numbers/Bytes.X.'xdev temp)
temp=countcheck(bbspath'Numbers/Files.X.'xdev 0)+tfiles
CALL countcheck(bbspath'Numbers/Files.X.'xdev temp)
line=line 'dled'
END
line=line protocol TIME('C') bytes 'bytes' PRAGMA('D')
CALL send2log(line)
EXIT 0
countcheck:
PARSE ARG fname' 'cknum .
IF ~EXISTS(fname) THEN
DO
IF cknum=0 THEN RETURN 0
IF OPEN(f,fname,'W')=0 THEN RETURN 0
CALL WRITELN(f,cknum)
CALL CLOSE(f)
RETURN cknum
END
IF OPEN(f,fname,'R')=0 THEN
DO
CALL DELAY(99)
IF OPEN(f,fname,'R')=0 THEN RETURN cknum
END
retval=STRIP(READLN(f))
CALL CLOSE(f)
IF ~DATATYPE(retval,'W') THEN retval=0
IF ~DATATYPE(cknum,'W') THEN cknum=0
IF retval<cknum THEN
DO
IF OPEN(f,fname,'W')~=0 THEN
DO
CALL WRITELN(f,cknum)
CALL CLOSE(f)
RETURN cknum
END
END
RETURN retval
send2log:
PARSE ARG sendline
logfile=bbspath'Logs/log.'DATE('S')
IF ~OPEN('log',logfile,'A') THEN
DO
IF ~OPEN('log',logfile,'W') THEN
DO
SAY 'failed to open log file'CR
RETURN
END
END
CALL WRITELN('log',sendline)
CALL CLOSE('log')
RETURN
FAILURE:
SYNTAX:
lin.1='
'ERRORTEXT(RC)'
'
lin.2=SIGL-1 SOURCELINE(SIGL-1)
lin.3=SIGL '
'SOURCELINE(SIGL)'
'
lin.4=SIGL+1 SOURCELINE(SIGL+1)
DO er=1 TO 4
IF level>sysoplevel | ~frombb THEN SAY 'bbsKillUser:' lin.er||CR
IF frombb THEN CALL send2log('bbsXferStats:' lin.er)
END
EXIT 1
/* bbsXferStats.rexx */